<?php

/**
 * This is the model class for table "wx_user".
 *
 * The followings are the available columns in table 'wx_user':
 * @property string $User_ID
 * @property string $wx_id
 * @property string $Weixin_ID
 * @property integer $Is_Active
 * @property string $Active_Time
 * @property string $Weixin_Name
 * @property integer $Weixin_Sex
 * @property string $Weixin_City
 * @property string $Weixin_Province
 * @property string $Weixin_Country
 * @property string $Weixin_Avatar
 * @property string $Subscribe_Time
 * @property integer $Bind_Flag
 * @property string $Mobile_No
 * @property string $Real_Name
 * @property string $Remark
 * @property string $Role_ID
 * @property string $Role_Name
 * @property integer $Integral_TotalNum
 * @property integer $subscribe
 * @property string $create_time
 * @property string $update_time
 * @property string $created_by
 * @property string $updated_by
 * @property integer $is_delete
 * @property string $group_id
 * @property string $taglist
 */
class WxUser extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @param string $className active record class name.
	 * @return WxUser the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'wx_user';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('wx_id, Weixin_ID, Is_Active', 'required'),
			array('Is_Active, Weixin_Sex, Bind_Flag, Integral_TotalNum, subscribe, is_delete', 'numerical', 'integerOnly'=>true),
			array('wx_id, Weixin_ID, Weixin_Name, Weixin_City, Weixin_Province, Weixin_Country, Mobile_No, Real_Name, Remark, Role_Name, created_by, updated_by, group_id, taglist', 'length', 'max'=>255),
			array('Role_ID', 'length', 'max'=>64),
			array('Active_Time, Weixin_Avatar, Subscribe_Time, create_time, update_time', 'safe'),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('User_ID, wx_id, Weixin_ID, Is_Active, Active_Time, Weixin_Name, Weixin_Sex, Weixin_City, Weixin_Province, Weixin_Country, Weixin_Avatar, Subscribe_Time, Bind_Flag, Mobile_No, Real_Name, Remark, Role_ID, Role_Name, Integral_TotalNum, subscribe, create_time, update_time, created_by, updated_by, is_delete, group_id, taglist', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'User_ID' => 'User',
			'wx_id' => 'Wx',
			'Weixin_ID' => 'Weixin',
			'Is_Active' => 'Is Active',
			'Active_Time' => 'Active Time',
			'Weixin_Name' => 'Weixin Name',
			'Weixin_Sex' => 'Weixin Sex',
			'Weixin_City' => 'Weixin City',
			'Weixin_Province' => 'Weixin Province',
			'Weixin_Country' => 'Weixin Country',
			'Weixin_Avatar' => 'Weixin Avatar',
			'Subscribe_Time' => 'Subscribe Time',
			'Bind_Flag' => 'Bind Flag',
			'Mobile_No' => 'Mobile No',
			'Real_Name' => 'Real Name',
			'Remark' => 'Remark',
			'Role_ID' => 'Role',
			'Role_Name' => 'Role Name',
			'Integral_TotalNum' => 'Integral Total Num',
			'subscribe' => 'Subscribe',
			'create_time' => 'Create Time',
			'update_time' => 'Update Time',
			'created_by' => 'Created By',
			'updated_by' => 'Updated By',
			'is_delete' => 'Is Delete',
			'group_id' => 'Group',
			'taglist' => 'Taglist',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('User_ID',$this->User_ID,true);
		$criteria->compare('wx_id',$this->wx_id,true);
		$criteria->compare('Weixin_ID',$this->Weixin_ID,true);
		$criteria->compare('Is_Active',$this->Is_Active);
		$criteria->compare('Active_Time',$this->Active_Time,true);
		$criteria->compare('Weixin_Name',$this->Weixin_Name,true);
		$criteria->compare('Weixin_Sex',$this->Weixin_Sex);
		$criteria->compare('Weixin_City',$this->Weixin_City,true);
		$criteria->compare('Weixin_Province',$this->Weixin_Province,true);
		$criteria->compare('Weixin_Country',$this->Weixin_Country,true);
		$criteria->compare('Weixin_Avatar',$this->Weixin_Avatar,true);
		$criteria->compare('Subscribe_Time',$this->Subscribe_Time,true);
		$criteria->compare('Bind_Flag',$this->Bind_Flag);
		$criteria->compare('Mobile_No',$this->Mobile_No,true);
		$criteria->compare('Real_Name',$this->Real_Name,true);
		$criteria->compare('Remark',$this->Remark,true);
		$criteria->compare('Role_ID',$this->Role_ID,true);
		$criteria->compare('Role_Name',$this->Role_Name,true);
		$criteria->compare('Integral_TotalNum',$this->Integral_TotalNum);
		$criteria->compare('subscribe',$this->subscribe);
		$criteria->compare('create_time',$this->create_time,true);
		$criteria->compare('update_time',$this->update_time,true);
		$criteria->compare('created_by',$this->created_by,true);
		$criteria->compare('updated_by',$this->updated_by,true);
		$criteria->compare('is_delete',$this->is_delete);
		$criteria->compare('group_id',$this->group_id,true);
		$criteria->compare('taglist',$this->taglist,true);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}